﻿using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using NHibernate.Mapping.Attributes;
using Lib;

namespace Persistance.Model
{
    [Serializable]
    [Class(Lazy = true)]
    public class LogEntryType
    {

        /// <summary>
        /// This is needed for NH. NH only accepts numeric primary keys
        /// </summary>
        private int _logEntryTypeID;
        //NHIBER: Setts the primary key to ID
        [Id(Name = "LogEntryTypeID")]
        [Generator(1, Class = "native")]
        public virtual int LogEntryTypeID
        {
            get { return _logEntryTypeID; }
            set { _logEntryTypeID = value; }
        }

        /// <summary>
        /// Candidate key. Represents the unique username of the user
        /// </summary>
        private string _typeName;
        [Property(Length = 256)]
        public virtual string TypeName
        {
            get { return _typeName; }
            set { _typeName = value; }
        }

        /// <summary>
        /// Candidate key. Represents the unique username of the user
        /// </summary>
        private int _typeSeverity;
        [Property(Type = "int")]
        public virtual int TypeSeverity
        {
            get { return _typeSeverity; }
            set { _typeSeverity = value; }
        }

        private ApplicationLog _log;
        [ManyToOne(Column = "ApplicationLogID", Cascade = CascadeStyle.All, Unique = true)]
        public virtual ApplicationLog Log
        {
            get { return _log; }
            set { _log = value; }
        }
    }
}
